From: Florian Müllner Date: Fri, 10 Jan 2020 18:26:05 +0000 (+0100) Subject: screenshot: Fix stripping suffix from relative filename X-Git-Tag: archive/raspbian/50.5-1+rpi1~1^2~781^2^2~224 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=4c6a0678fff5118880101211c84214fde61e9cb6;p=gnome-shell.git screenshot: Fix stripping suffix from relative filename String.prototype.substr() doesn't support a negative length value (to subtract from the full length), so we end up with a filename of '' when hitting that code paths (a relative filename with '.png' suffix). Fix this by switching to String.prototype.replace() instead. https://gitlab.gnome.org/GNOME/gnome-shell/issues/2091 --- diff --git a/js/ui/screenshot.js b/js/ui/screenshot.js index 60278a8f3..09f5c5109 100644 --- a/js/ui/screenshot.js +++ b/js/ui/screenshot.js @@ -65,8 +65,7 @@ var ScreenshotService = class { } *_resolveRelativeFilename(filename) { - if (GLib.str_has_suffix(filename, '.png')) - filename = filename.substr(0, -4); + filename = filename.replace(/\.png$/, ''); let path = [ GLib.get_user_special_dir(GLib.UserDirectory.DIRECTORY_PICTURES),